# RUN: llc --debugify-and-strip-all-safe=0 -o - %s -mtriple=aarch64-- -mattr=+v8.1a -run-pass=greedy,virtregrewriter | FileCheck %s
# Make sure spills/reloads from xseqpairs and wseqpairs work correctly.
---
# CHECK-LABEL: name: spill_reload_xseqpairs
name: spill_reload_xseqpairs
body: |
  bb.0:
    ; Check the spill/reload sequence for the %0 register
    ; CHECK: renamable $[[REG0:[a-z0-9]+]]_[[REG1:[a-z0-9]+]] = CASPALX
    ; CHECK-NEXT: STPXi renamable $[[REG0]], renamable $[[REG1]], %stack.0, 0, implicit killed $[[REG0]]_[[REG1]] :: (store (s128) into %stack.0, align 8)
    ; CHECK: INLINEASM
    ; CHECK: renamable $[[REG2:[a-z0-9]+]], renamable $[[REG3:[a-z0-9]+]] = LDPXi %stack.0, 0, implicit-def $[[REG2]]_[[REG3]] :: (load (s128) from %stack.0, align 8)
    ; CHECK-NEXT: $xzr = COPY renamable $[[REG2]]
    ; CHECK-NEXT: $xzr = COPY renamable $[[REG3]]
    %0 : xseqpairsclass = IMPLICIT_DEF
    %1 : xseqpairsclass = IMPLICIT_DEF
    %2 : gpr64common = IMPLICIT_DEF
    %0 = CASPALX %0, %1, %2
    INLINEASM &" ", 0, 12, implicit def dead $x0, implicit def dead $x1, implicit def dead $x2, implicit def dead $x3, implicit def dead $x4, implicit def dead $x5, implicit def dead $x6, implicit def dead $x7, implicit def dead $x8, implicit def dead $x9, implicit def dead $x10, implicit def dead $x11, implicit def dead $x12, implicit def dead $x13, implicit def dead $x14, implicit def dead $x15, implicit def dead $x16, implicit def dead $x17, implicit def dead $x18, implicit def dead $x19, implicit def dead $x20, implicit def dead $x21, implicit def dead $x22, implicit def dead $x23, implicit def dead $x24, implicit def dead $x25, implicit def dead $x26, implicit def dead $x27, implicit def dead $x28, implicit def dead $fp, implicit def dead $lr
    $xzr = COPY %0.sube64
    $xzr = COPY %0.subo64
...
---
# CHECK-LABEL: name: spill_reload_wseqpairs
name: spill_reload_wseqpairs
body: |
  bb.0:
    ; Check the spill/reload sequence for the %0 register
    ; CHECK: $[[REG0:[a-z0-9]+]]_[[REG1:[a-z0-9]+]] = CASPALW
    ; CHECK-NEXT: STPWi renamable $[[REG0]], renamable $[[REG1]], %stack.0, 0, implicit killed $[[REG0]]_[[REG1]] :: (store (s64) into %stack.0, align 4)
    ; CHECK: INLINEASM
    ; CHECK: renamable $[[REG2:[a-z0-9]+]], renamable $[[REG3:[a-z0-9]+]] = LDPWi %stack.0, 0, implicit-def $[[REG2]]_[[REG3]] :: (load (s64) from %stack.0, align 4)
    ; CHECK-NEXT: $xzr = COPY renamable $[[REG2]]
    ; CHECK-NEXT: $xzr = COPY renamable $[[REG3]]
    %0 : wseqpairsclass = IMPLICIT_DEF
    %1 : wseqpairsclass = IMPLICIT_DEF
    %2 : gpr64common = IMPLICIT_DEF
    %0 = CASPALW %0, %1, %2
    INLINEASM &" ", 0, 12, implicit def dead $x0, implicit def dead $x1, implicit def dead $x2, implicit def dead $x3, implicit def dead $x4, implicit def dead $x5, implicit def dead $x6, implicit def dead $x7, implicit def dead $x8, implicit def dead $x9, implicit def dead $x10, implicit def dead $x11, implicit def dead $x12, implicit def dead $x13, implicit def dead $x14, implicit def dead $x15, implicit def dead $x16, implicit def dead $x17, implicit def dead $x18, implicit def dead $x19, implicit def dead $x20, implicit def dead $x21, implicit def dead $x22, implicit def dead $x23, implicit def dead $x24, implicit def dead $x25, implicit def dead $x26, implicit def dead $x27, implicit def dead $x28, implicit def dead $fp, implicit def dead $lr
    $xzr = COPY %0.sube32
    $xzr = COPY %0.subo32
...
